import {Body, Controller, HttpCode, HttpStatus, Post} from "@nestjs/common";
import {AuthService} from "./auth.service";
import {SysUserService} from "../sys_user/sys_user.service";
import {CreateSysUserDto} from "../sys_user/dto/create-sys_user.dto";

@Controller('')
export class AuthController {
    constructor(private readonly authService: AuthService, private readonly sysUserService: SysUserService) {}
    /**
     * 用户登录
     * @param user
     */
    @Post('login/account')
    async login(@Body() user) {
        return await this.authService.login(user)
    }

    /**
     * 用户注册
     * @param createSysUserDto
     */
    @Post("register")
    @HttpCode(HttpStatus.CREATED)
    create(@Body() createSysUserDto: CreateSysUserDto) {
        return this.sysUserService.create(createSysUserDto);
    }


}
